import {OPERATION_LOG} from '@/services/api'
import {request, METHOD} from '@/utils/request'

/**
 *
 * @param pageQuery
 * @returns Promise<AxiosResponse>
 */
export async function page(pageQuery) {
    return request(OPERATION_LOG.OPERATION_LOG_PAGE, METHOD.POST, {
        ...pageQuery
    })
}

export const columns = [
    {
        title: '控制器',
        dataIndex: 'controller',
        align: 'center',
    },
    {
        title: '方法',
        dataIndex: 'method',
        align: 'center',
    },
    {
        title: '参数',
        dataIndex: 'params',
        align: 'center',
        ellipsis: true
    },
    {
        title: '执行时间',
        dataIndex: 'executionTime',
        align: 'center',
    },
    {
        title: '请求方式',
        dataIndex: 'httpMethod',
        align: 'center',
    },
    {
        title: '执行结果',
        dataIndex: 'success',
        align: 'center',
        scopedSlots: {customRender: 'resultIndex'}
    },
    {
        title: '错误信息',
        dataIndex: 'errorMsg',
        align: 'center',
        ellipsis: true
    },
    {
        title: '客户端IP',
        dataIndex: 'ip',
        align: 'center',
    },
    {
        title: '操作者',
        dataIndex: 'createUser',
        align: 'center',
    },
    {
        title: '操作时间',
        dataIndex: 'createTime',
        align: 'center',
    },
    {
        title: '操作',
        align: 'center',
        scopedSlots: {customRender: 'action'}
    }
]
